package quoridorDecisionMaker;

import java.util.Iterator;

import quoridor.*;

public class AIDecisionMakerDumb extends AbstractDecisionMaker {
	PlayerColour playerColour;
	
	public AIDecisionMakerDumb(Board board) {
		super(board);
	}
	
	public Action getAction() {
		QuoridorDisplay.instance().printBoard(board);
		Move bestMove = null;
		Move childMove;
		int tmpScore;
		int bestScore = Integer.MIN_VALUE;
		Iterator <Move> itr;
		playerColour = board.currentPlayer();
		MoveSearch moveSearch = new MoveSearch(board);
		
		itr = moveSearch.getMoves().iterator();
		while(itr.hasNext()) {
			childMove = itr.next();
			
			tmpScore = Heuristic.scoreBoard(getChildBoard(board, childMove), playerColour);
			if (tmpScore >= bestScore) {
				bestScore = tmpScore;
				bestMove = childMove;
			}
		}
			
		return new QuoridorAction(bestMove);
	}

}
